#pragma once

#include "View.h"

namespace mscene
{
	class Camera;
	class Scene;
	class Node;
}

namespace mgfx
{
	class RenderingSystem;
	class MeshInstance;
	class PointLight;
	class SpotLight;
}

namespace mphys
{
	class PhysicsSystem;
}

namespace mgui
{
	struct EventArgs;
}

namespace medit
{
	class RenderSettingsGui;
}

namespace game
{
	class GameView : public mcore::View
	{
	public:
		GameView()
		{
			mName = "Game View";
			mTotalTime = 0.0f;
		}
		virtual ~GameView()
		{
		}

		void init(mscene::Scene * scene, mgfx::RenderingSystem * rendSys, mphys::PhysicsSystem * physSys);

		void load();
		virtual void unload();
		virtual void onResize() {}
		virtual void update(float dt);
		virtual void draw();

		virtual bool onWindowMessage(UINT msg, WPARAM wParam, LPARAM lParam);

	private:
		void initGui();

		void receiveButtonChange(const mgui::EventArgs * args);

		float mTotalTime;

		mgfx::RenderingSystem * mRenderSystem;
		mphys::PhysicsSystem * mPhysicsSystem;

		mscene::Scene * mScene;

		mscene::Camera * mCamera;
		std::vector<mgfx::MeshInstance*> mMeshes;
		mgfx::PointLight * mLight;
		mgfx::SpotLight * msLight;

		int mPrevMousePosX, mPrevMousePosY;

		medit::RenderSettingsGui * mRenderSettingsGui;
	};
}